package com.cn.xcsharp.dataconfig;

import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.core.JdbcTemplate;

import javax.sql.DataSource;

@Configuration
public class JdbcTemplateConfig {
    @Bean
    //注入orcle数据源到jdbcTemplateOrcle
    JdbcTemplate jdbcTemplateOrcle(@Qualifier("orcle") DataSource orcle){
        return new JdbcTemplate(orcle);
    }
    @Bean//注入mysql数据源到jdbcTemplateMysql
    JdbcTemplate jdbcTemplateMysql(@Qualifier("mysql") DataSource mysql){
        return new JdbcTemplate(mysql);
    }
}
